<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/carousel.css" rel="stylesheet">

	<style>

        #imgconinter {
            position: relative;
            text-align: center;
            width: 160px;
            margin: 120px auto;
            border: 2px solid;
            padding: 5px;
            cursor: pointer;
        }

        .float-tag {
            background-color: hotpink;
            position: absolute;
            right: -20px;
            top: -20px;
            color: white;
            line-height: 20px;
            padding: 2px 6px;
        }

        #cnt-tag {
            background-color: red;
            position: absolute;
            right: 5px;
            top: 5px;
            color: white;
            line-height: 20px;
            padding: 2px 6px;
        }

        #ac { }

	</style>
  </head>
  <body>

    <div id="imgconinter">
        <img id="ac" src="./img/1.png">
        <span id="cnt-tag" style="display: none"></span>
    </div>

    <script src="js/jquery-2.2.0.min.js"></script>
    <script src="js/jquery.easing.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script>
        $(function() {
            var cnt = 0, png = 1, point = $('#cnt-tag'), vf = function() { };
            $('#imgconinter').click(function() {
                if(cnt == 0) { point.show(); }
                point.text(cnt += 1);
                if(cnt != 0 && cnt % 10 == 0) {
                    png = [1,2,3,4,5][png % 5];
                    $('#ac').attr('src', './img/' + png + '.png');
                }
                point.before(function() {
                    var inner = $('<div class="float-tag" style="opacity: 0.0">+1 Click</div>');
                    inner.animate({ top: '-=40', opacity: '+=1.0' }, 800, 'easeOutExpo', vf)
                        .animate({ top: '-=30', opacity: '-=1.0'}, 400, 'easeInExpo', function() {
                            inner.remove();
                        });
                    return inner;
                });
            });
        });
    </script>
  </body>
</html>
